package com.cf.r1029_e;

import java.io.*;
import java.util.HashSet;
import java.util.Set;

public class c {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StreamTokenizer in = new StreamTokenizer(br);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        in.nextToken(); int T = (int) in.nval;
        while (T-- > 0) {
            solve();
        }
        out.flush();
        out.close();
        br.close();
    }

    static int[] a;
    static Set<Integer> pre;
    static int n;

    static void solve() throws IOException {
        in.nextToken(); n = (int) in.nval;
        a = new int[n];
        for (int i = 0; i < n; i++) {
            in.nextToken(); a[i] = (int) in.nval;
        }
        pre = new HashSet<>();
        pre.add(a[0]);
        int ans = 0;
        for (int i = 1; i < n;) {
            int x = f(i);
            if (x == n) break;
            ans++;
            i = x + 1;
        }
        out.println(ans + 1);
    }

    static int f(int i) {
        Set<Integer> set = new HashSet<>(pre);
        pre.clear();
        for (int j = i; j < n; j++) {
            int x = a[j];
            set.remove(x);
            pre.add(x);
            if (set.isEmpty()) {
                return j;
            }
        }
        return n;
    }
}
